<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>

    <div id="app">
        <h1>hello, {{name}}</h1>
        <button v-on:click="showInfo1">无参事件</button>
        <button @click="showInfo2($event, 666)">传递参数事件</button>
    </div>

    <script>
        new Vue({
            el: '#app',
            data: {
                name: 'world',
            },
            methods: {
                showInfo1(){
                    alert('无参数传递')
                },
                // 或者 指定事件对象，两个等价
                // showInfo1(event){
                //     console.log(event.target.innerText)
                //     alert('无参数传递')
                // },
                showInfo2(event, number){
                    console.log(event, number)
                    alert('有参数传递')
                }
            }
        })
    </script>
</body>
</html>